package jtk.project4.fleet.screen.partUsed;


import java.sql.SQLException;

import jtk.project4.fleet.FleetModel;
import jtk.project4.fleet.domain.PartHist;
import jtk.project4.fleet.domain.Parts;
import jtk.project4.fleet.event.AddPartUsedEvent;
import nl.coderight.jazz.Controller;

public class PartUsedController extends Controller{
	private FleetModel fleetModel;
	private PartUsedView partUsedView;
	
	public void handleEvent(AddPartUsedEvent evt) throws SQLException {
		//Parts parts = fleetModel.getParts();
		PartHist partHist = fleetModel.getPartHist();
		switch (evt.getType()) {
		case SAVE:
			System.out.print("controller");
			fleetModel.insertPartHist(partHist);
			break;

		default:
			propagateEvent(evt);
			break;
		}
	}
	
	@Override
	public void execute() {
		fleetModel = (FleetModel) getModel();
		partUsedView = new PartUsedView();
		setView(partUsedView);
		showView();
	}
	
}
